
    //% color="#f08080" iconWidth=50 iconHeight=40
    namespace HapticMotorDriver {   
    //% block="Init Haptic Motor Driver" blockType="command"
    export function myBlock0(parameter: any, block: any) {
        Generator.addInclude("myBlock4248",`#include "DFRobot_TM6605.h""`)
        Generator.addObject("myBlock2068",`DFRobot_TM6605 TM6605`,"")
        Generator.addSetup("myBlock8780",`while(TM6605.begin()!=0){delay(1000);} `)
    }

    //% block="Set haptic motor working in [mode] mode!" blockType="command"
    //% mode.shadow="dropdown" mode.options="mode"
    export function myBlock1(parameter: any, block: any) {
        let mode= parameter.mode.code
        Generator.addInclude("myBlock4248",`#include "DFRobot_TM6605.h""`)
        Generator.addObject("myBlock2068",`DFRobot_TM6605 TM6605`,"")
        Generator.addSetup("myBlock8780",`while(TM6605.begin()!=0){delay(1000);} `)
        Generator.addCode(`TM6605.selectEffect(DFRobot_TM6605::${mode});`)
        Generator.addCode(`TM6605.play();`)
    }

    //% block="Set haptic motor stop" blockType="command"
    export function myBlock2(parameter: any, block: any) {
        Generator.addInclude("myBlock4248",`#include "DFRobot_TM6605.h""`)
        Generator.addObject("myBlock2068",`DFRobot_TM6605 TM6605`,"")
        Generator.addSetup("myBlock8780",`while(TM6605.begin()!=0){delay(1000);} `)
        Generator.addCode(`TM6605.stop();`)
    }
}
    